package com.ruoyi.common.config.mybatis.method;

import lombok.Getter;

/**
 * @Classname SqlMethod
 * @Author: sunluquan
 * @Date: 2021/12/23 11:30
 * @Description TODO
 */
@Getter
public enum SqlMethod {

    /**
     * 逻辑删除
     */
    LOGIC_DELETE_BY_ID("logicDeleteById", "根据ID 逻辑删除一条数据", "<script>\nUPDATE %s %s WHERE %s=#{%s} %s\n</script>"),
    LOGIC_DELETE("logicDelete", "根据 entity 条件逻辑删除记录", "<script>\nUPDATE %s %s %s %s\n</script>"),
    LOGIC_DELETE_BATCH_BY_IDS("logicDeleteBatchByIds", "根据ID集合，批量逻辑删除数据", "<script>\nUPDATE %s %s WHERE %s IN (%s) %s\n</script>"),

    /**
     * 恢复为 未被标记为删除的数据
     */
    RECOVER_BY_ID("recoverById","根据ID 恢复未被标记为删除的数据","<script>\nUPDATE %s %s WHERE %s=#{%s} %s\n</script>"),
    RECOVER_BATCH_BY_IDS("recoverBatchByIds","根据ID集合，批量恢复被标记为删除的数据","<script>\nUPDATE %s %s WHERE %s IN (%s) %s\n</script>");

    private final String method;
    private final String desc;
    private final String sql;

    SqlMethod(String method, String desc, String sql) {
        this.method = method;
        this.desc = desc;
        this.sql = sql;
    }
}
